package com.googlecode.lookie.platform.prefs;

import java.awt.GridBagLayout;

import javax.swing.JPanel;
import javax.swing.JCheckBox;
import java.awt.GridBagConstraints;
import javax.swing.JLabel;
import javax.swing.JSlider;
import java.awt.Insets;

public class GeneralPreferencePanel
    extends JPanel
{

    private static final long serialVersionUID = 1L;

    private JCheckBox showTipsCheckBox = null;

    private JLabel thumbSizeLabel = null;

    private JSlider thumbSizeSlider = null;

    private JCheckBox useNativeIconsCheckBox = null;

    /**
     * This is the default constructor
     */
    public GeneralPreferencePanel()
    {
        super();
        initialize();
    }

    public GeneralPreferencePanel( GeneralPreferencePanelParams params )
    {
        super();

        showTipsCheckBox = params.getShowTipsCheckBox();
        thumbSizeLabel = params.getThumbSizeLabel();
        thumbSizeSlider = params.getThumbSizeSlider();
        useNativeIconsCheckBox = params.getUseNativeIconsCheckBox();

        initialize();
    }

    /**
     * This method initializes this
     *
     * @return void
     */
    private void initialize()
    {
        GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
        gridBagConstraints11.gridx = 0;
        gridBagConstraints11.insets = new Insets( 3, 3, 3, 3 );
        gridBagConstraints11.anchor = GridBagConstraints.WEST;
        gridBagConstraints11.fill = GridBagConstraints.HORIZONTAL;
        gridBagConstraints11.weightx = 1.0;
        gridBagConstraints11.gridwidth = 2;
        gridBagConstraints11.gridy = 1;
        GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
        gridBagConstraints2.fill = GridBagConstraints.VERTICAL;
        gridBagConstraints2.gridy = 2;
        gridBagConstraints2.weightx = 1.0;
        gridBagConstraints2.gridx = 1;
        GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
        gridBagConstraints1.gridx = 0;
        gridBagConstraints1.insets = new Insets( 3, 3, 3, 3 );
        gridBagConstraints1.fill = GridBagConstraints.HORIZONTAL;
        gridBagConstraints1.anchor = GridBagConstraints.WEST;
        gridBagConstraints1.gridy = 2;
        thumbSizeLabel = new JLabel();
        thumbSizeLabel.setText( "Thumbnail Size" );
        GridBagConstraints gridBagConstraints = new GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.anchor = GridBagConstraints.WEST;
        gridBagConstraints.insets = new Insets( 3, 3, 3, 3 );
        gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.gridy = 0;
        this.setSize( 300, 200 );
        this.setLayout( new GridBagLayout() );
        this.add( getShowTipsCheckBox(), gridBagConstraints );
        this.add( thumbSizeLabel, gridBagConstraints1 );
        this.add( getThumbSizeSlider(), gridBagConstraints2 );
        this.add( getUseNativeIconsCheckBox(), gridBagConstraints11 );
    }

    /**
     * This method initializes showTipsCheckBox
     *
     * @return javax.swing.JCheckBox
     */
    private JCheckBox getShowTipsCheckBox()
    {
        if ( showTipsCheckBox == null )
        {
            showTipsCheckBox = new JCheckBox();
            showTipsCheckBox.setText( "Show Tips at Startup" );
        }
        return showTipsCheckBox;
    }

    /**
     * This method initializes thumbSizeSlider
     *
     * @return javax.swing.JSlider
     */
    private JSlider getThumbSizeSlider()
    {
        if ( thumbSizeSlider == null )
        {
            thumbSizeSlider = new JSlider();
        }
        return thumbSizeSlider;
    }

    /**
     * This method initializes useNativeIconsCheckBox
     *
     * @return javax.swing.JCheckBox
     */
    private JCheckBox getUseNativeIconsCheckBox()
    {
        if ( useNativeIconsCheckBox == null )
        {
            useNativeIconsCheckBox = new JCheckBox();
            useNativeIconsCheckBox.setText( "Use Native Icons" );
        }
        return useNativeIconsCheckBox;
    }

}
